package ch.bfh.aufs.prologparser.view;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;

import ch.bfh.aufs.prologparser.controller.PPController;
import ch.bfh.aufs.prologparser.view.subpanels.DisplayPanel;
import ch.bfh.aufs.prologparser.view.subpanels.FileChoosePanel;

public class MainFrame extends JFrame{

    private static final long serialVersionUID = 1L;
    public static final int MAINFRAME_WIDTH = 700;
    public static final int MAINFRAME_HEIGHT = 500;
    
    public Dimension mainframeSize = new Dimension(MAINFRAME_WIDTH,MAINFRAME_HEIGHT);
    
    private FileChoosePanel choosePanel;
    private DisplayPanel dilsplayPanel;
    
    public MainFrame(PPController controller){
        this.setSize(mainframeSize);
        this.setTitle("PrologParser");
        this.setResizable(false);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        
        this.setLayout(new BorderLayout());
        this.choosePanel = new FileChoosePanel(controller);
        
        this.dilsplayPanel = new DisplayPanel(controller, choosePanel);
        
        controller.addObserver(choosePanel);
        controller.addObserver(dilsplayPanel);
        
        this.add(choosePanel, BorderLayout.NORTH);
        this.add(dilsplayPanel, BorderLayout.CENTER);
        
        this.setVisible(true);
    }

}
